/**
 * 
 */
package com.unlp.javaclickers.helper;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.service.ServiceRegistryBuilder;

/**
 * @author Pablo
 * 
 *         This class serves as a helper for Hibernate connection and session
 * 
 */
public class HibernateUtil {

	static Configuration configuration = new Configuration().configure();
	static ServiceRegistry serviceRegistry = new ServiceRegistryBuilder()
			.applySettings(configuration.getProperties())
			.buildServiceRegistry();
	private static SessionFactory sessionFactory = configuration
			.buildSessionFactory(serviceRegistry);

	public static SessionFactory getSessionFactory() {
		return sessionFactory;
	}

	public static void shutDown() {
		getSessionFactory().close();
	}

}
